/*
 * Copyright 2010 Aekold Helbrass
 * 
 * This file is part of RosterComposer.
 * 
 * RosterComposer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * RosterComposer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with RosterComposer.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.heresylabs.rostercomposer.units;

import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Aekold Helbrass <Helbrass@gmail.com>
 */
public class BaseEntry implements java.io.Serializable {

    @XmlAttribute(name = "name")
    protected String name;
    @XmlAttribute(name = "cost")
    protected int cost;
    @XmlAttribute(name = "minNumber")
    protected int minNumber = 1;
    @XmlAttribute(name = "maxNumber")
    protected int maxNumber = 1;
    @XmlAttribute(name = "shortName")
    protected String shortName;
    @XmlElements({
        @XmlElement(name = "option", type = Option.class)})
    protected List<Option> options;

    @XmlTransient
    public int getCost() {
        return cost;
    }

    @XmlTransient
    public int getMaxNumber() {
        return maxNumber;
    }

    @XmlTransient
    public int getMinNumber() {
        return minNumber;
    }

    @XmlTransient
    public String getName() {
        return name;
    }

    @XmlTransient
    public List<Option> getOptions() {
        return options;
    }

    @XmlTransient
    public String getShortName() {
        if (shortName == null || shortName.isEmpty()) {
            return name;
        }
        return shortName;
    }

    @Override
    public String toString() {
        return name;
    }

    // <editor-fold defaultstate="collapsed" desc=" for serializer only ">
    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setCost(int cost) {
        this.cost = cost;
    }

    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setMaxNumber(int maxNumber) {
        this.maxNumber = maxNumber;
    }

    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setMinNumber(int minNumber) {
        this.minNumber = minNumber;
    }

    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setOptions(List<Option> options) {
        this.options = options;
    }

    /**
     * @deprecated this method is for serializer only
     */
    @Deprecated
    public void setShortName(String shortName) {
        this.shortName = shortName;
    }
    // </editor-fold>

}
